package ws.jdbc.concurrent.test.tasks;

import java.sql.ResultSet;
import java.sql.SQLException;
import ws.jdbc.concurrent.cursor.CursorFactoryImpl;
import ws.jdbc.concurrent.cursor.ICursorFactory;
import ws.jdbc.concurrent.cursor.ICursorScrollUpdate;
import ws.jdbc.concurrent.exception.JdbcConcurrentException;

/**
 *
 * @author Wilson Santos, 36228 <wilson.santos@ua.pt>
 */
public abstract class CursorRunnable implements Runnable {

  protected static ResultSet rs;
  protected static ICursorFactory factory = null;
  protected final ICursorScrollUpdate cursor;
  protected int num = 76;
  protected String str1 = "c1", str2 = "c2";
  protected float decimal = 6.2f;

  public CursorRunnable() throws SQLException, JdbcConcurrentException {
    assert factory != null;
    cursor = factory.createScrollUpdate();
  }

  public static void setRs(ResultSet rs) {
    assert rs != null;
    CursorRunnable.rs = rs;
    factory = new CursorFactoryImpl(rs);
  }
}
